<template>
  <div>
    <h1>姓名：{{ info.name }}</h1>
    <h1>年龄：{{ info.age }}</h1>
    <h1>兴趣：{{ info.interest }}</h1>

  </div>
</template>

<script>
import axios from "axios";

export default {
  name: "asyncData",
  data() {
    return {
      name: "hello world",
    }
  },
  /*asyncData() {
    return axios.get('https://getman.cn/mock/getInfo')
      .then(res => {
        //此处返回相当于data中多个info的对象
        return {info: res.data}
      })
  }*/
  async asyncData() {
    let {data} = await axios.get('https://getman.cn/mock/getInfo')
    return {info: data}
  }
}
</script>

<style scoped>

</style>
